//--------------------Sonic CD HUD Script---------------------//
//--------Scripted by Christian Whitehead 'The Taxman'--------//
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//

// Aliases
// Not all of these are used here in the HUD script, some are just used as a way for other objects to globally transmit values
private alias Object.Value0 : Object.Timer     //	you know this one
private alias Object.Value1 : Object.CameraState     // which cam ur watching
private alias Object.Value2 : Object.Static     // for when an animatronic moves while you watch them

private alias Object.Value3 : Object.ActiveStatic
private alias Object.Value4 : Object.StaticTimer    // Which Camer frame
private alias Object.Value5 : Camera.TouchTimer    // Which Camer frame
private alias Object.Value6 : Mask.SlideIn    // Which Camer frame
private alias Object.Value7 : Camera.Frame    // Which Camer frame
private alias Object.Value8 : Camera.FrameEnd    // last camera frame

private alias object.value9 : Camera.Scroll
private alias object.value10 : Camera.ScrollDirection

private alias object.value11 : Camera.ScrollTimer

private alias object.value12 : Bonnie.Pose
private alias object.value13 : Chica.Pose

private alias object.value14 : Camera.Type
private alias object.value15 : Camera.Hints
private alias object.value16 : Camera.Bear5

private alias object.value17 : CamGame.State
private alias object.value18 : CamGame.Camera
private alias object.value19 : CamGame.Static
private alias object.value20 : CamGame.Dead

private alias Object[16].Value3 : Object.PuppetWind
private alias Object[16].Value8 : Object.IsWinding

public alias saveRAM[295] : saved.mobile

private alias Object[3].Value3 : Object.FlashOn

//VENT CREW

private alias object[17].state : Springtrap.State
private alias object[20].state : WitheredChica.State
private alias object[22].state : BalloonBoy.State
private alias object[23].state : JJ.State
private alias object[27].state : Mangle.State


private alias object[17].value4 : Springtrap.AI
private alias object[20].value4 : WitheredChica.AI
private alias object[22].value4 : BalloonBoy.AI
private alias object[23].value4 : JJ.AI
private alias object[27].value4 : Mangle.AI

// Game Mode Aliases
public value OfficePower = 100;
public value CameraEnabled = 0;
public value CameraType = 0;

public value LeftVentDoor = 0;
public value RightVentDoor = 0;
public value MidVentDoor = 0;


public value GameLeftDoor = 0;
public value GameRightDoor = 0;
public value GameMiddleDoor = 0;

// Priority
private alias 1 : PRIORITY_ACTIVE

private alias 0  : CAMERA_WAITACTIVATE
private alias 1  : CAMERA_FLIPUP
private alias 2  : CAMERA_MAIN
private alias 10  : CAMERA_EXIT

private alias 0 : CAM_SHOWSTAGE_0
private alias 1 : CAM_DININGHALL_1
private alias 2 : CAM_BACKSTAGE_2
private alias 3 : CAM_PIRATESCOVE_3
private alias 4 : CAM_WESTHALL_4
private alias 5 : CAM_CLOSET_5
private alias 6 : CAM_WHALLCORNER_6
private alias 7 : CAM_EASTHALL_7
private alias 8 : CAM_EHALLCORNER_8
private alias 9 : CAM_KITCHEN_9
private alias 10 : CAM_BATHROOMS_10
private alias 11 : CAM_PRIZECORNER_11

//Vent States
private alias 0 : VENT_START

private alias 1 : VENT_TOPLEFT_1
private alias 2 : VENT_TOPMIDLEFT_2
private alias 3 : VENT_TOPMIDDLE_3
private alias 4 : VENT_TOPMIDRIGHT_4
private alias 5 : VENT_TOPRIGHT_5

private alias 6 : VENT_MIDLEFT_6
private alias 7 : VENT_MIDMIDLEFT_7
private alias 8 : VENT_MIDDLEMIDDLE_8
private alias 9 : VENT_MIDMIDRIGHT_9
private alias 10 : VENT_MIDRIGHT_10

private alias 11 : VENT_BOTTOMLEFT_11
private alias 12 : VENT_BOTTOMMIDLEFT_12
private alias 13 : VENT_BOTTOMMIDDLE_13
private alias 14 : VENT_BOTTOMMIDRIGHT_14
private alias 15 : VENT_BOTTOMRIGHT_15

private alias 16 : VENT_MIDDOOR
private alias 17 : VENT_LEFTDOOR
private alias 18 : VENT_RIGHTDOOR


private alias 0 : CAMERA_HALLS_0
private alias 1 : CAMERA_VENTS_1
private alias 2 : CAMERA_GAME_2

//MASK

private alias object[10].state : Freddy.State
private alias object[11].state : Bonnie.State
private alias object[12].state : Chica.State
private alias object[13].state : Foxy.State

private alias 30  : MASK_MAIN
private alias 31  : MASK_EXIT


private alias 0  : MRHUGS_LEFT
private alias 1  : MRHUGS_RIGHT
private alias 2  : MRHUGS_TOP


reserve function Camera_TouchControls
reserve function Camera_UI
reserve function Camera_PuppetUI
reserve function CameraCharVents

//awful, absolutely horuednous coding
function CameraCharVents
	if CameraType == 1
		if BalloonBoy.AI > 0
			temp0 = screen.xsize
			temp3 = 92
			switch Object[22].Value9
				case VENT_START
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 100)	//head
				break
				case VENT_TOPLEFT_1
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPMIDLEFT_2
					temp0 -= 120
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPMIDDLE_3
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPMIDRIGHT_4
					temp0 -= 68
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPRIGHT_5
					temp0 -= 42
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break		

				case VENT_MIDLEFT_6
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDMIDLEFT_7
					temp0 -= 120
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDDLEMIDDLE_8
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDMIDRIGHT_9
					temp0 -= 68
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDRIGHT_10
					temp0 -= 42
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break		


				case VENT_BOTTOMLEFT_11
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMMIDLEFT_12
					temp0 -= 120
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMMIDDLE_13
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMMIDRIGHT_14
					temp0 -= 68
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMRIGHT_15
					temp0 -= 42
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break	

				//vent doors

				case VENT_MIDDOOR
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 135)	//head
				break
				case VENT_LEFTDOOR
					temp0 -= 115
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_RIGHTDOOR
					temp0 -= 72
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break								
			end switch
		end if	


		if JJ.AI > 0
			//JJ BOY
			/////////////////////////////////////////////////////
			temp0 = screen.xsize
			temp3 = 95
			switch Object[23].Value9
				case VENT_START
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 100)	//head
				break
				case VENT_TOPLEFT_1
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPMIDLEFT_2
					temp0 -= 120
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPMIDDLE_3
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPMIDRIGHT_4
					temp0 -= 68
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPRIGHT_5
					temp0 -= 42
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break		

				case VENT_MIDLEFT_6
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDMIDLEFT_7
					temp0 -= 120
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDDLEMIDDLE_8
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDMIDRIGHT_9
					temp0 -= 68
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDRIGHT_10
					temp0 -= 42
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break		


				case VENT_BOTTOMLEFT_11
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMMIDLEFT_12
					temp0 -= 120
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMMIDDLE_13
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMMIDRIGHT_14
					temp0 -= 68
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMRIGHT_15
					temp0 -= 42
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break	

				//vent doors

				case VENT_MIDDOOR
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 135)	//head
				break
				case VENT_LEFTDOOR
					temp0 -= 115
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_RIGHTDOOR
					temp0 -= 72
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break								
			end switch
		end if	


		if Springtrap.AI > 0
			/////////////////////////////////////////////////////
			///SPRING TRAP
			temp0 = screen.xsize
			temp3 = 93
			switch Object[17].Value9
				case VENT_START
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 100)	//head
				break
				case VENT_TOPLEFT_1
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPMIDLEFT_2
					temp0 -= 120
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPMIDDLE_3
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPMIDRIGHT_4
					temp0 -= 68
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPRIGHT_5
					temp0 -= 42
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break		

				case VENT_MIDLEFT_6
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDMIDLEFT_7
					temp0 -= 120
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDDLEMIDDLE_8
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDMIDRIGHT_9
					temp0 -= 68
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDRIGHT_10
					temp0 -= 42
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break		


				case VENT_BOTTOMLEFT_11
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMMIDLEFT_12
					temp0 -= 120
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMMIDDLE_13
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMMIDRIGHT_14
					temp0 -= 68
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMRIGHT_15
					temp0 -= 42
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break	

				//vent doors

				case VENT_MIDDOOR
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 135)	//head
				break
				case VENT_LEFTDOOR
					temp0 -= 115
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_RIGHTDOOR
					temp0 -= 72
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break								
			end switch	
		end if	
		//CHICA
		if WitheredChica.AI > 0
			temp0 = screen.xsize
			temp3 = 94
			switch Object[20].Value9
				case VENT_START
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 100)	//head
				break
				case VENT_TOPLEFT_1
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPMIDLEFT_2
					temp0 -= 120
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPMIDDLE_3
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPMIDRIGHT_4
					temp0 -= 68
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPRIGHT_5
					temp0 -= 42
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break		

				case VENT_MIDLEFT_6
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDMIDLEFT_7
					temp0 -= 120
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDDLEMIDDLE_8
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDMIDRIGHT_9
					temp0 -= 68
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDRIGHT_10
					temp0 -= 42
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break		


				case VENT_BOTTOMLEFT_11
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMMIDLEFT_12
					temp0 -= 120
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMMIDDLE_13
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMMIDRIGHT_14
					temp0 -= 68
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMRIGHT_15
					temp0 -= 42
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break	

				//vent doors

				case VENT_MIDDOOR
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 135)	//head
				break
				case VENT_LEFTDOOR
					temp0 -= 115
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_RIGHTDOOR
					temp0 -= 72
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break								
			end switch
		end if	

		if Mangle.AI > 0
			//JJ BOY
			/////////////////////////////////////////////////////
			temp0 = screen.xsize
			temp3 = 97
			switch Object[27].Value9
				case VENT_START
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 100)	//head
				break
				case VENT_TOPLEFT_1
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPMIDLEFT_2
					temp0 -= 120
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPMIDDLE_3
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPMIDRIGHT_4
					temp0 -= 68
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break
				case VENT_TOPRIGHT_5
					temp0 -= 42
					DrawSpriteScreenXY(temp3, temp0, 90)	//head
				break		

				case VENT_MIDLEFT_6
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDMIDLEFT_7
					temp0 -= 120
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDDLEMIDDLE_8
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDMIDRIGHT_9
					temp0 -= 68
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break
				case VENT_MIDRIGHT_10
					temp0 -= 42
					DrawSpriteScreenXY(temp3, temp0, 124)	//head
				break		


				case VENT_BOTTOMLEFT_11
					temp0 -= 145
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMMIDLEFT_12
					temp0 -= 120
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMMIDDLE_13
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMMIDRIGHT_14
					temp0 -= 68
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_BOTTOMRIGHT_15
					temp0 -= 42
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break	

				//vent doors

				case VENT_MIDDOOR
					temp0 -= 93
					DrawSpriteScreenXY(temp3, temp0, 135)	//head
				break
				case VENT_LEFTDOOR
					temp0 -= 115
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break
				case VENT_RIGHTDOOR
					temp0 -= 72
					DrawSpriteScreenXY(temp3, temp0, 157)	//head
				break								
			end switch
		end if	
	end if
end function

function Camera_PuppetUI
	if Object.CameraState == CAM_PRIZECORNER_11
		temp3 += screen.xsize
		temp3 -= 190
		if inputdown.select == 1
			DrawSpriteScreenXY(78, temp3, 180)	//flashlight
			Object.IsWinding = 1
		else
			DrawSpriteScreenXY(77, temp3, 180)	//flashlight
			Object.IsWinding = 0
		end if	

		temp3 -= 55


		if Object.PuppetWind > 70
			DrawSpriteScreenXY(79, temp3, 140)	//flashlight
		end if
		if Object.PuppetWind > 60
			DrawSpriteScreenXY(80, temp3, 140)	//flashlight
		end if
		if Object.PuppetWind > 50
			DrawSpriteScreenXY(81, temp3, 140)	//flashlight
		end if
		if Object.PuppetWind > 40
			DrawSpriteScreenXY(82, temp3, 140)	//flashlight
		end if
		if Object.PuppetWind > 30
			DrawSpriteScreenXY(83, temp3, 140)	//flashlight
		end if
		if Object.PuppetWind > 20
			DrawSpriteScreenXY(84, temp3, 140)	//flashlight
		end if
		if Object.PuppetWind > 10
			DrawSpriteScreenXY(85, temp3, 140)	//flashlight
		end if												
		if Object.PuppetWind > 0
			DrawSpriteScreenXY(86, temp3, 140)	//flashlight
		end if	
	else
		Object.IsWinding = 0	
	end if
end function


function Camera_UI

	object.inkeffect = INK_ALPHA

	if object.alpha > 30
		object.alpha -= 8
	else
		object.alpha = 30
	end if	

	Object.StaticTimer++
	if Object.StaticTimer == 1
		temp2 = 41
		Rand(temp3, 3)
		temp2 += temp3
		Object.StaticTimer = 0
	end if
	
	//Background	
	temp0 = 0
	FlipSign(temp0)
	while temp0 < screen.ysize
		temp1 = temp0
		FlipSign(temp1)
		while temp1 < screen.xsize
			DrawSpriteScreenFX(temp2, FX_INK ,temp1, temp0)
			temp1 += 32
		loop
		temp0 += 32
	loop


		//ui stuff that isnt really important
		//MAP
	switch CameraType
	case CAMERA_HALLS_0	//main map
		temp1 = Screen.xsize
		temp1 -= 160
		DrawSpriteScreenXY(26, temp1, 80)	//MAP

		//draw the button
		//the image is prob gonna be handled above this
		temp1 = Screen.xsize
		temp2 = screen.ysize
		switch Object.CameraState
		case CAM_SHOWSTAGE_0
			temp1 -= 115
			temp2 -= 159
		break
		case CAM_DININGHALL_1
			temp1 -= 115
			temp2 -= 137
		break	
		case CAM_BACKSTAGE_2
			temp1 -= 160
			temp2 -= 129
		break			
		case 3
			temp1 -= 131
			temp2 -= 108
		break		
		case CAM_WESTHALL_4
			temp1 -= 117
			temp2 -= 75
		break	
		case CAM_CLOSET_5
			temp1 -= 145
			temp2 -= 75
		break		
		case CAM_WHALLCORNER_6
			temp1 -= 117
			temp2 -= 58
		break	
		case CAM_EASTHALL_7
			temp1 -= 76
			temp2 -= 75
		break	
		case CAM_EHALLCORNER_8
			temp1 -= 76
			temp2 -= 58
		break		
		case CAM_KITCHEN_9
			temp1 -= 38
			temp2 -= 82
		break		
		case CAM_BATHROOMS_10
			temp1 -= 37
			temp2 -= 135
		break		
		case CAM_PRIZECORNER_11
			temp1 -= 96
			temp2 -= 92
		break						
		end switch

		temp3 = Object.CameraState
		temp3 += 27
		DrawSpriteScreenXY(temp3, temp1, temp2)	//MAP
	break
	case CAMERA_VENTS_1
		temp1 = Screen.xsize
		temp1 -= 160
		DrawSpriteScreenXY(89, temp1, 80)	//MAP

		if LeftVentDoor == 1
			temp1 = Screen.xsize
			temp1 -= 96
			DrawSpriteScreenXY(90, temp1, 167)	//MAP
		end if

		if MidVentDoor == 1
			temp1 = Screen.xsize
			temp1 -= 90
			DrawSpriteScreenXY(91, temp1, 160)	//MAP
		end if

		if RightVentDoor == 1
			temp1 = Screen.xsize
			temp1 -= 79
			DrawSpriteScreenXY(90, temp1, 167)	//MAP
		end if		
	break
	case CAMERA_GAME_2
		temp1 = Screen.xsize
		temp1 -= 145
		switch CamGame.Camera
			case 0
				DrawSpriteScreenXY(98, temp1, 90)	//cameras
			break
			case 1
				DrawSpriteScreenXY(99, temp1, 90)	//cameras
			break
			case 2
				DrawSpriteScreenXY(100, temp1, 90)	//cameras
			break
		end switch

		if CamGame.Camera == CamGame.State
			temp3 = Screen.xsize
			temp3 -= 145		
			switch CamGame.State
			case MRHUGS_LEFT	//left
				temp3 += 60	
				DrawSpriteScreenXY(108, temp3, 120)	//cameras
			break
			case MRHUGS_RIGHT	//left
				temp3 += 40	
				DrawSpriteScreenXY(110, temp3, 120)	//cameras
			break			
			case MRHUGS_TOP	//top
				temp3 += 40	
				DrawSpriteScreenXY(109, temp3, 120)	//cameras
			break
			end switch
		endif



		if CamGame.Static > 0
			CamGame.Static--
			DrawSpriteScreenXY(101, temp1, 90)	//cameras
		end if	

		temp1 += 4
		DrawSpriteScreenXY(102, temp1, 94)	//hud

		//selected icon
		switch CamGame.Camera
			case 0
				DrawSpriteScreenXY(103, temp1, 121)	//cameras
			break
			case 2
				temp1 += 23
				DrawSpriteScreenXY(105, temp1, 98)	//cameras
			break	
			case 1
				temp1 += 44
				DrawSpriteScreenXY(104, temp1, 121)	//cameras
			break								
		end switch

		temp2  = Screen.xsize
		temp2 -= 145
		if GameLeftDoor == 1
			temp2 += 21
			DrawSpriteScreenXY(106, temp2, 122)	//cameras
		end if

		if GameMiddleDoor == 1
			temp2 += 29
			DrawSpriteScreenXY(107, temp2, 113)	//cameras
		end if

		if GameRightDoor == 1
			temp2 += 41
			DrawSpriteScreenXY(106, temp2, 122)	//cameras
		end if		

		if CamGame.Dead == 1
			temp4 = Screen.xsize
			temp4 -= 145
			DrawSpriteScreenXY(111, temp4, 90)	//cameras
		end if

	break
	end switch

		//OUTLINE
		//top and bottom
		temp0 = screen.xsize
		temp0 -= 8
		DrawRect(4, 4, temp0, 2, color7, color7, color7, 255)// 1
		DrawRect(4, 234, temp0, 2, color7, color7, color7, 255)// 1

		temp0 = screen.ysize
		temp0 -= 10
		DrawRect(4, 4, 2, temp0, color7, color7, color7, 255)// 1

		temp1 = screen.xsize
		temp1 -= 6
		DrawRect(temp1, 4, 2, temp0, color7, color7, color7, 255)// 1
		//red ball	
		DrawSpriteScreenXY(25, 12, 12)	//ba	

end function

function Camera_TouchControls

	//para android	touch rects
	CheckTouchRect(0, 0, screen.xsize, screen.ysize)
	if checkResult == -1
		Camera.TouchTimer = false
	end if
	if camera.TouchTimer == 1
		object[8].value5 = 0
	end if
	if Camera.TouchTimer == 0
		switch CameraType
		case CAMERA_HALLS_0
			//object.value0 is 0 here but ... ykn ow what ok

			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 118
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 89
			CheckTouchRect(temp0, 78, temp1, 98)
			if CheckResult > -1
				Object.ActiveStatic = 1
				Camera.TouchTimer = 1
				Object.CameraState = 0
				PlaySfx(SfxName[Blip], 0)	
			end if


			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 118
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 89
			CheckTouchRect(temp0, 100, temp1, 120)
			if CheckResult > -1
				Object.ActiveStatic = 1
				Camera.TouchTimer = 1
				Object.CameraState = 1
				PlaySfx(SfxName[Blip], 0)	
			end if


			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 163
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 135	
			CheckTouchRect(temp0, 108, temp1, 130)
			if CheckResult > -1
				Object.ActiveStatic = 1
				Camera.TouchTimer = 1
				Object.CameraState = 2
				PlaySfx(SfxName[Blip], 0)	
			end if


			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 133
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 105	
			CheckTouchRect(temp0, 130, temp1, 150)
			if CheckResult > -1
				Object.ActiveStatic = 1
				Camera.TouchTimer = 1
				Object.CameraState = 3
				PlaySfx(SfxName[Blip], 0)	
			end if

			//L hall 1
			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 119
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 93
			CheckTouchRect(temp0, 164, temp1, 180)
			if CheckResult > -1
				Object.ActiveStatic = 1
				Camera.TouchTimer = 1
				Object.CameraState = 4
				PlaySfx(SfxName[Blip], 0)	
			end if

			//closet
			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 147
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 121
			CheckTouchRect(temp0, 165, temp1, 180)
			if CheckResult > -1
				Object.ActiveStatic = 1
				Camera.TouchTimer = 1
				Object.CameraState = 5
				PlaySfx(SfxName[Blip], 0)	
			end if

			//L hall 2
			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 119
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 93
			CheckTouchRect(temp0, 182, temp1, 200)
			if CheckResult > -1
				Object.ActiveStatic = 1
				Camera.TouchTimer = 1
				Object.CameraState = 6
				PlaySfx(SfxName[Blip], 0)	
			end if


			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 78
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 53
			CheckTouchRect(temp0, 164, temp1, 180)
			if CheckResult > -1
				Object.ActiveStatic = 1
				Camera.TouchTimer = 1
				Object.CameraState = 7
				PlaySfx(SfxName[Blip], 0)	
			end if


			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 78
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 53
			CheckTouchRect(temp0, 182, temp1, 200)
			if CheckResult > -1
				Object.ActiveStatic = 1
				Camera.TouchTimer = 1
				Object.CameraState = 8
				PlaySfx(SfxName[Blip], 0)	
			end if


			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 40
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 13
			CheckTouchRect(temp0, 156, temp1, 175)
			if CheckResult > -1
				Object.ActiveStatic = 1
				Camera.TouchTimer = 1
				Object.CameraState = 9
				PlaySfx(SfxName[Blip], 0)	
			end if

			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 40
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 13
			CheckTouchRect(temp0, 103, temp1, 125)
			if CheckResult > -1
				Object.ActiveStatic = 1
				Camera.TouchTimer = 1
				Object.CameraState = 10
				PlaySfx(SfxName[Blip], 0)	
			end if		


			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 98
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 72
			CheckTouchRect(temp0, 148, temp1, 163)
			if CheckResult > -1
				Object.ActiveStatic = 1
				Camera.TouchTimer = 1
				Object.CameraState = 11
				PlaySfx(SfxName[Blip], 0)	
			end if	
		break
		case CAMERA_VENTS_1
			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 100
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 90
			CheckTouchRect(temp0, 167, temp1, 178)
			if CheckResult > -1
				Camera.TouchTimer = 1
				inputpress.left = 1
				PlaySfx(SfxName[Door], 0)	
			end if

			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 81
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 70
			CheckTouchRect(temp0, 167, temp1, 178)
			if CheckResult > -1
				Camera.TouchTimer = 1
				inputpress.right = 1
				PlaySfx(SfxName[Door], 0)	
			end if

			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 91
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 80
			CheckTouchRect(temp0, 158, temp1, 167)
			if CheckResult > -1
				Camera.TouchTimer = 1
				inputpress.up = 1
				PlaySfx(SfxName[Door], 0)	
			end if

		break
		case CAMERA_GAME_2
		if CamGame.Dead == 0
			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 140
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 125
			CheckTouchRect(temp0, 115, temp1, 135)
			if CheckResult > -1
				Camera.TouchTimer = 1
				CamGame.Camera = 0
				CamGame.Static = 5
				PlaySfx(SfxName[Blip], 0)	
			end if

			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 100
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 80
			CheckTouchRect(temp0, 115, temp1, 135)
			if CheckResult > -1
				Camera.TouchTimer = 1
				CamGame.Camera = 1
				CamGame.Static = 5
				PlaySfx(SfxName[Blip], 0)	
			end if	

			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 120
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 100
			CheckTouchRect(temp0, 95, temp1, 108)
			if CheckResult > -1
				Camera.TouchTimer = 1
				CamGame.Camera = 2
				CamGame.Static = 5
				PlaySfx(SfxName[Blip], 0)	
			end if

			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 125
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 115
			CheckTouchRect(temp0, 120, temp1, 131)
			if CheckResult > -1
				Camera.TouchTimer = 1
				GameLeftDoor = 1
				GameMiddleDoor = 0
				GameRightDoor = 0
				PlaySfx(SfxName[Door], 0)	
			end if

			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 110
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 100
			CheckTouchRect(temp0, 120, temp1, 131)
			if CheckResult > -1
				Camera.TouchTimer = 1
				GameLeftDoor = 0
				GameMiddleDoor = 0
				GameRightDoor = 1
				PlaySfx(SfxName[Door], 0)	
			end if			
		
			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 120
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 102
			CheckTouchRect(temp0, 110, temp1, 118)
			if CheckResult > -1
				Camera.TouchTimer = 1
				GameLeftDoor = 0
				GameMiddleDoor = 1
				GameRightDoor = 0
				PlaySfx(SfxName[Door], 0)	
			end if	
		end if
		break
		end switch	

		temp0 = object.value0
		temp0 += screen.xsize
		temp0 -= screen.xsize
		temp1 = object.value0
		temp1 += screen.xsize
		temp1 -= 190
		CheckTouchRect(temp0, 8, temp1, 200)
		if CheckResult > -1
			inputdown.buttonz = 1
		end if	

		//music box
		if CameraType == 0
			temp0 = object.value0
			temp0 += screen.xsize
			temp0 -= 182
			temp1 = object.value0
			temp1 += screen.xsize
			temp1 -= 149
			CheckTouchRect(temp0, 140, temp1, 161)
			if CheckResult > -1
				inputdown.select = 1
			end if			
		end if

		//cam switcher
		temp0 = object.value0
		temp0 += screen.xsize
		temp0 -= 182
		temp1 = object.value0
		temp1 += screen.xsize
		temp1 -= 149
		CheckTouchRect(temp0, 165, temp1, 186)
		if CheckResult > -1
			Camera.TouchTimer = 1
			inputpress.buttonY = 1
		end if	
	end if

end function

event ObjectMain
	switch object.State
	case CAMERA_WAITACTIVATE
		if Object[5].Type == TypeName[Blank Object]
			//no mask?
			CheckEqual(PlayerJumpscared, 0)
			temp0 = checkResult
			CheckEqual(NightWon, 0)
			temp0 &= checkResult			
			if temp0 == 1
				if OfficePower > 0
					CheckEqual(inputpress.buttonB, 1)
					temp1 = checkResult					
					if temp1 == 1
						CameraEnabled = 1
						PlaySfx(SfxName[Camera], 0)	
						object.animation = 1
						Camera.Frame = 11
						PowerUsage++
						object.state++
					end if
				end if		
					
					if MaskMode == 1
						if inputpress.buttonY == 1
							CameraEnabled = 0
							object.animation = 3
							PlaySfx(SfxName[Mask On], 0)	
							PlaySfx(SfxName[Breathing], 1)	
							object.state = MASK_MAIN
						end if	
					end if	
				
			end if
		end if
	break
	case CAMERA_FLIPUP
		if Camera.Frame == 16
			object.animation = 0
			object.state++
		end if
	break
	case CAMERA_MAIN

		CallFunction(Camera_TouchControls)
			
		if object.state == 2
			if FlashLocked == 0
				if inputdown.buttonz == 1
					if Object.FlashOn == 0
						Object.FlashOn = 1
						PlaySfx(SfxName[CamLight], 1)
						PowerUsage++
					end if
				else	
					if Object.FlashOn == 1
						PowerUsage--
						StopSfx(SfxName[CamLight])
						Object.FlashOn = 0
					end if		
				end if	
			else
				if inputpress.buttonz == 1
					PlaySfx(SfxName[Error], 0)
				end if	
				StopSfx(SfxName[CamLight])	
			end if	
		else
			StopSfx(SfxName[CamLight])	
		end if	

		switch CameraType
		case CAMERA_HALLS_0
			if inputpress.right == 1
				Object.ActiveStatic = 1
				object[8].value5 = 0
				PlaySfx(SfxName[Blip], 0)	
				if Object.CameraState < 11
					Object.CameraState++
				else
					Object.CameraState = 0
				end if
			end if	

			if inputpress.left == 1
				Object.ActiveStatic = 1
				object[8].value5 = 0
				PlaySfx(SfxName[Blip], 0)	
				if Object.CameraState > 0
					Object.CameraState--
				else
					Object.CameraState = 11
				end if
			end if	
		break
		case CAMERA_VENTS_1
			if inputpress.left == 1
				if LeftVentDoor == 0
					LeftVentDoor = 1

					if RightVentDoor == 1
						RightVentDoor = 0
					end if	
					if MidVentDoor == 1
						MidVentDoor = 0
					end if					
				else
					if LeftVentDoor == 1
						LeftVentDoor = 0
					end if
				end if		
				PlaySfx(SfxName[Door], 0)	
			end if

			if inputpress.up == 1
				if MidVentDoor == 0
					MidVentDoor = 1

					if RightVentDoor == 1
						RightVentDoor = 0
					end if	
					if LeftVentDoor == 1
						LeftVentDoor = 0
					end if	

				else
					if MidVentDoor == 1
						MidVentDoor = 0
					end if
				end if		
				PlaySfx(SfxName[Door], 0)	
			end if	

			if inputpress.right == 1
				if RightVentDoor == 0
					RightVentDoor = 1

					if LeftVentDoor == 1
						LeftVentDoor = 0
					end if	
					if MidVentDoor == 1
						MidVentDoor = 0
					end if	

				else
					if RightVentDoor == 1
						RightVentDoor = 0
					end if
				end if		
				PlaySfx(SfxName[Door], 0)	
			end if			
		break
		case CAMERA_GAME_2
			if CamGame.Dead == 0
				if inputpress.down == 1
					if CamGame.Camera < 2
						CamGame.Camera++
					else
						CamGame.Camera = 0
					end if		
					CamGame.Static = 5
					PlaySfx(SfxName[Blip], 0)	
				end if

				if inputpress.left == 1
					GameMiddleDoor = 0
					GameRightDoor = 0
					if GameLeftDoor == 0
						GameLeftDoor = 1
					else
						if GameLeftDoor == 1
							GameLeftDoor = 0
						end if
					end if
					PlaySfx(SfxName[Door], 0)	
				end if		

				if inputpress.up == 1
					GameLeftDoor = 0
					GameRightDoor = 0			
					if GameMiddleDoor == 0
						GameMiddleDoor = 1
					else
						if GameMiddleDoor == 1
							GameMiddleDoor = 0
						end if
					end if
					PlaySfx(SfxName[Door], 0)	
				end if		

				if inputpress.right == 1
					GameLeftDoor = 0
					GameMiddleDoor = 0			
					if GameRightDoor == 0
						GameRightDoor = 1
					else
						if GameRightDoor == 1
							GameRightDoor = 0
						end if
					end if
					PlaySfx(SfxName[Door], 0)	
				end if		
			end if	
		break
		end switch	



		CheckEqual(PlayerJumpscared, 1)
		temp1 = checkResult
		CheckEqual(inputpress.buttonB, 1)
		temp1 |= checkResult		
		CheckEqual(OfficePower, 0)
		temp1 |= checkResult	
		CheckEqual(ForcePull, 1)
		temp1 |= checkResult	
		if temp1 == 1
			Camera.Frame = 18
			StopSfx(SfxName[CamLight])	
			PlaySfx(SfxName[Camera], 0)	
			object.animation = 2

			rand(Camera.Bear5, 100)	//bear5

			object.state = CAMERA_EXIT
			PowerUsage--
		end if
		if object.ActiveStatic == 1
			object.alpha = 160
			object.ActiveStatic = 0
		end if

		

	break
	case CAMERA_EXIT
		if Camera.frame == 23
			ForcePull = 0
			object.animation = 0
			CameraEnabled = 0
			object.state = 0
		end if
	break

	case MASK_MAIN
		if Mask.SlideIn < 190
			Mask.SlideIn += 24
		else
			Mask.SlideIn = 190
			MaskEquipped = 1
		end if
		if MaskEquipped == 1
			CheckEqual(inputpress.buttonY, 1)
			temp1 = checkResult
			CheckEqual(PlayerJumpscared, 1)
			temp1 |= checkResult
			if temp1 == 1
				PlaySfx(SfxName[Mask Off], 0)	
				object.state++
			end if
		end if
	break
	case MASK_EXIT
		if Mask.SlideIn > -60
			Mask.SlideIn -= 24
			StopSfx(SfxName[Breathing])
		else
			MaskEquipped = 0
			Mask.SlideIn = -60
		end if
		if MaskEquipped == 0
			object.animation = 0
			object.state = CAMERA_WAITACTIVATE
		end if
	break
	end switch


	
end event

event ObjectDraw
	// Find the initial X Position to draw the HUD elements
	
	if object.state == CAMERA_EXIT
		if Camera.Bear5 == 1
			DrawSpriteScreenXY(96, screen.xcenter, 240)	//BAR
		end if
	end if

	if OfficePower != 0
		if object.state != 2
			if FlashLocked == 0
				if inputdown.buttonZ == 1
					temp0=128
					temp0*=512
					temp0>>=9
					

					temp5=256
					temp5*=512
					temp5>>=9

					temp1=screen.xcenter
					temp1-=temp0

					temp2=temp1
					temp2+=temp5

					temp3=120
					temp3-=temp0

					temp4=temp3
					temp4+=temp5

					DrawRect(0, 0, temp1, screen.ysize, 0x00, 0x00, 0x00, 64)
					DrawRect(temp2, 0, screen.xsize, screen.ysize, 0x00, 0x00, 0x00, 64)
					DrawRect(temp1, 0, temp5, temp3, 0x00, 0x00, 0x00, 64)
					DrawRect(temp1, temp4, temp5, screen.ysize, 0x00, 0x00, 0x00, 64)
					
					temp6 = screen.xsize
					temp6 -= screen.xcenter

					object.InkEffect = INK_ALPHA
					object.alpha = 64		
					DrawSpriteScreenFX(74,FX_INK,temp6,screen.ycenter)
					object.alpha = 64
				else
					DrawRect(0, 0, screen.xsize, screen.ysize, 0, 0, 0, 64)// 1
				end if	
			else
				DrawRect(0, 0, screen.xsize, screen.ysize, 0, 0, 0, 64)// 1	
			end if	
		endif
	else
		
	end if

	switch object.animation
	case 0

	break
	case 1

	// This function is used for animating the object, here's a short overview of the values it uses
		// (Frame values are in accordance with SpriteFrames set in ObjectStartup)
		// -> Camera.AnimationSpeed is the speed at which Sonic should animate, it's added to his timer every frame
		// -> Camera.FrameTimer is the timer used for animating Sonic, think of it akin to Object.AnimationTimer
		//     - The next frame is triggered whenever the value is 240 or above, the speed is controlled by Camera.AnimationSpeed
		//     - This doesn't get reset whenever the frame transitions, so keep that in mind too
		// -> Camera.FrameEnd is the final frame of the animation
		// -> Camera.FrameLoop is the loop point for the animation to go back to after reaching its end
		// -> Camera.Frame is the frame to be displayed when drawing the object
		
		// For each animation's corresponding values, check out the ANI_* aliases up above
		
		Object.AnimationTimer += 128
		
		if Object.AnimationTimer > 239
			Object.AnimationTimer -= 240
			
			Camera.Frame++
			if Camera.Frame > 16
				Camera.Frame = 16
			end if
		end if

		DrawSpriteScreenXY(Camera.Frame, screen.xcenter, 190)	//BAR
		if Camera.Frame == 16
			DrawRect(0, 0, screen.xsize, screen.ysize, 0, 0, 0, 255)// 1
		end if

	break
	case 2
		
		Object.AnimationTimer += 128
		
		if Object.AnimationTimer > 239
			Object.AnimationTimer -= 240
			
			Camera.Frame++
			if Camera.Frame > 23
				Camera.Frame = 23
			end if
		end if

		DrawSpriteScreenXY(Camera.Frame, screen.xcenter, 190)	//BAR

	break	
	case 3	//mask
		DrawSpriteScreenXY(40, screen.xcenter, Mask.SlideIn)	//BAR
	break
	end switch
	
	

	if Object[5].Type == TypeName[Blank Object]
		if object.state == CAMERA_MAIN


			//static
			CallFunction(Camera_UI)

			

			if Camera.Hints > 0			
				Camera.Hints--
				if inputdown.buttona == 1
					DrawSpriteScreenFX(76, FX_INK, screen.xcenter, screen.ycenter)	//flashlight
				else
					DrawSpriteScreenFX(75,FX_INK,  screen.xcenter, screen.ycenter)	//flashlight
				end if	
			end if


			if CameraType == CAMERA_HALLS_0 
				CallFunction(Camera_PuppetUI)
			else
				Object.IsWinding = 0			
			end if	


			temp4 = screen.xsize
			temp4 -= 156
			if inputpress.buttonY == 1
				DrawSpriteScreenXY(88, temp4, 205)	//flashlight

				if stage.actnum == 7
					if CameraType < 2
						CameraType++
					else
						CameraType = 0	
					end if
				else
					if CameraType < 1
						CameraType++
					else
						CameraType = 0	
					end if
				end if	

			//	if CameraType == CAMERA_HALLS_0
			//		CameraType = CAMERA_VENTS_1
			//	else
			//		if CameraType == CAMERA_VENTS_1
			//			CameraType = CAMERA_HALLS_0
			//		end if
			//	end if

				PlaySfx(SfxName[Blip], 0)	
			else
				DrawSpriteScreenXY(87, temp4, 205)	//flashlight
			end if	

			Callfunction(CameraCharVents)



		end if

	end if

	//DrawNumbers(0, temp1, 12, object.camerastate, 3, 8, 0)	//number
end event


event ObjectStartup
	
	LoadSpriteSheet("FNAF/Camera.gif")
	
	// Place the HUD object into reserved object slot 4 and initialise its values
	Object[6].Type = TypeName[Camera]
	
	// The object should always be run, regardless if it's within camera bounds or not
	Object[6].Priority = PRIORITY_ACTIVE
	
	// Make the HUD draw ontop of all other sprites, too
	Object[6].DrawOrder = 5
	
	object[6].value9 = screen.xcenter

	switch stage.actnum
	case 1
	case 2
		object[6].value15 = 1500
	break
	default
		object[6].value15 = 0
	break	
	end switch	

	object[6].value17 = -1

	// 0-9 - Numbers 0-9
	SpriteFrame(0, 0, 8, 13, 558, 1)
	SpriteFrame(0, 0, 8, 13, 567, 1)
	SpriteFrame(0, 0, 8, 13, 576, 1)
	SpriteFrame(0, 0, 8, 13, 585, 1)
	SpriteFrame(0, 0, 8, 13, 594, 1)
	SpriteFrame(0, 0, 8, 13, 558, 15)
	SpriteFrame(0, 0, 8, 13, 567, 15)
	SpriteFrame(0, 0, 8, 13, 576, 15)
	SpriteFrame(0, 0, 8, 13, 585, 15)
	SpriteFrame(0, 0, 8, 13, 594, 15)

	// 10 - Bar
	SpriteFrame(0, 0, 300, 23, 1, 1)		

	// 11 - camer frames
	SpriteFrame(-220, 15, 459, 36, 1, 25) //11
	SpriteFrame(-240, -25, 487, 76, 1, 62) //12
	SpriteFrame(-270, -90, 540, 166, 1, 139) //13	
	SpriteFrame(-300, -170, 606, 273, 1, 306) //14	
	SpriteFrame(-320, -200, 640, 360, 1, 580) //15
	SpriteFrame(-270, -200, 640, 360, 1, 580) //16	same as 15 but eh

	SpriteFrame(0, 0, 0, 0, 0, 0) //17 BLANK

	//THE SAME ANIMATION BUT BACKWARDS HELP

	SpriteFrame(-320, -200, 640, 360, 1, 580) //18
	SpriteFrame(-300, -170, 606, 273, 1, 306) //19	
	SpriteFrame(-270, -90, 540, 166, 1, 139) //20	
	SpriteFrame(-240, -25, 487, 76, 1, 62) //21
	SpriteFrame(-220, 15, 459, 36, 1, 25) //22
	SpriteFrame(-220, 15, 459, 36, 1, 25) //23 clone

	//old map idk what to do with it	24
	SpriteFrame(0, 0, 200, 172, 823, 851) //24 map big
	//25
	SpriteFrame(0, 0, 24, 24, 889, 1) //25 red baller	
	//26
	SpriteFrame(0, 0, 146, 124, 877, 726) //26 map small

	//27 - 38  Lit cameras

	//27	1A showstage
	//28	1B	dining room
	//29	5	Backstage
	//30	1C	Foxy Land
	//31	2A	West Hall	
	//32	3A	Closet
	//33	2B	W Hall Corner
	//34	4A	East Hall
	//35	4B	E Hall Corner
	//36	6	Kitchen
	//37	7	Bathrooms	
	//38	8	Prize Corner

	temp1 = 678
	while temp1 < 725
		temp0 = 784
		while temp0 < 876
			SpriteFrame(0, 0, 22, 15, temp0, temp1)
			temp0 += 23
		loop
		temp1 += 16
	loop


	// 39 - Bar
	SpriteFrame(0, 0, 300, 23, 1, 941)	


	SpriteFrame(-260, -260, 512, 384, 1025, 1) //40

	//static
	SpriteFrame(0, 0, 32, 32, 1025, 386)	//41
	SpriteFrame(0, 0, 32, 32, 992, 419)	//42
	SpriteFrame(0, 0, 32, 32, 992, 452)	//43
	SpriteFrame(0, 0, 32, 32, 1025, 386)	//44

	//showstage 1
	SpriteFrame(-220, -200, 480, 270, 806, 1024) //45
	//dinging
	SpriteFrame(-240, -230, 480, 270, 806, 1295) //46
	//couldve been a loop here but idc
	SpriteFrame(-240, -200, 480, 270, 1, 1506) //47
	SpriteFrame(-240, -200, 480, 270, 1, 1767) //48
	//left hall 1
	SpriteFrame(-240, -220, 480, 270, 482, 1566) //49	
	//lcose
	SpriteFrame(-240, -220, 480, 270, 963, 1566) //50	
	SpriteFrame(-240, -200, 480, 270, 1287, 1295) //51		
	
	//right hal
	SpriteFrame(-240, -200, 480, 270, 1, 1225) //52	

	//right hall
	SpriteFrame(-240, -200, 480, 270, 1444, 1566) //53		

	//KITCHEN which is nothign so
	SpriteFrame(-240, -200, 480, 270, 1444, 1566) //55		

	//bath
	SpriteFrame(-260, -200, 480, 263, 1287, 1031) //55		
	
	
	//FREDDY

	//showstage
	SpriteFrame(16, 0, 236, 228, 0, 996)	//56
	SpriteFrame(-19, 0, 24, 55, 238, 996)	//57
	SpriteFrame(-102, 25, 56, 122, 238, 1052)	//58	bath

	SpriteFrame(-22, 15, 29, 60, 263, 991)	//59	hllaway 1
	//hall corner
	SpriteFrame(-116, -12, 184, 202, 295, 1022)	//60	hllaway 1


	//BONNIE

	//showstage
	SpriteFrame(-280, -48, 287, 269, 1287, 761)	//61

	SpriteFrame(35, 0, 50, 100, 1575, 761)	//62

	SpriteFrame(35, 0, 52, 148, 1575, 862)	//63	//backstage

	//dining 2
	SpriteFrame(-128, 32, 147, 166, 1628, 863)	//64

	//left hall 1
	SpriteFrame(4, 32, 24, 51, 1628, 811)	//65

	//closet
	SpriteFrame(-132, -8, 103, 228, 1653, 634)	//66

	//hall corner
	SpriteFrame(-100, -28, 119, 255, 1346, 386)	//67


	//CHICKEN JOCKEY


	SpriteFrame(-80, -48, 138, 195, 1025, 597)	//68

	SpriteFrame(-82, -40, 46, 84, 1164, 708)	//69

	SpriteFrame(28, -40, 74, 112, 1164, 595)	//70
	SpriteFrame(-150, -40, 256, 128, 564, 1837)	//71
	SpriteFrame(-50, -40, 186, 148, 821, 1837)	//72
	
	//hall corner
	SpriteFrame(-30, -40, 126, 187, 1466, 386)	//73


	//flash
	SpriteFrame(-128,-128,256,256,1791,1)	//74

	SpriteFrame(-10, -20, 33, 33, 948, 1)	//75
	SpriteFrame(-10, -20, 33, 33, 914, 1)	//76

	//windup
	SpriteFrame(-30, -40, 34, 21, 841, 595)	//77	
	SpriteFrame(-30, -40, 34, 21, 806, 595)	//78


	//puppet bar
	//79 - 86

	temp2 = 617
	while temp2 < 659
		temp3 = 792
		while temp3 < 876
			SpriteFrame(0, 0, 20, 20, temp3, temp2)
			temp3 += 21
		loop
		temp2 += 21
	loop	


	SpriteFrame(-30, -40, 38, 21, 916, 579)	//87	
	SpriteFrame(-30, -40, 38, 21, 877, 579)	//88

	//vent map

	SpriteFrame(0, 0, 146, 124, 1025, 735) //89

	//horiz vent door blocked
	SpriteFrame(0, 0, 4, 9, 1281, 735) //90
	//verti door blocked
	SpriteFrame(0, 0, 9, 4, 1281, 745) //91


	//VENT ICONS
	SpriteFrame(0, 0, 15, 21, 495, 23) //92 //BB
	SpriteFrame(0, 0, 15, 21, 495, 1) //93 //SPRINGTRAP
	SpriteFrame(0, 0, 15, 21, 527, 1) //94	//CHICA
	SpriteFrame(0, 0, 15, 21, 511, 23) //95 //JJ

	//bea5
	SpriteFrame(-75, -180, 160, 214, 1589, 252) //96

	SpriteFrame(0, 0, 15, 21, 511, 1) //97 //JJ	


	//squid game

	SpriteFrame(0, 0, 131, 113, 1171, 908) //98
	SpriteFrame(0, 0, 131, 113, 1171, 1021) //99
	SpriteFrame(0, 0, 131, 113, 1171, 1132) //100
	SpriteFrame(2, 2, 127, 109, 1025, 974) //101

	SpriteFrame(0, 0, 59, 42, 1318, 951) //102	

	SpriteFrame(2, 0, 13, 8, 1378, 951) //103
	SpriteFrame(0, 0, 13, 8, 1378, 960) //104	
	SpriteFrame(0, 0, 13, 8, 1378, 969) //105	

	//horiz vent door blocked
	SpriteFrame(0, 0, 4, 9, 1378, 978) //106
	//verti door blocked
	SpriteFrame(0, 0, 9, 4, 1378, 988) //107

	//mr hugs
	SpriteFrame(0, 0, 34, 53, 1318, 897) //108
	SpriteFrame(0, 0, 55, 70, 1318, 994) //109
	SpriteFrame(0, 0, 34, 53, 1353, 897) //110

	SpriteFrame(0, 0, 131, 113, 1039, 1084) //111	

end event


// ========================
// Editor events
// ========================

event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad
	LoadSpriteSheet("3D_Test/Objects.gif")
	SpriteFrame(0, 0, 24, 16, 206, 58)

	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
